Can modules be added to the Python search path (e.g site-packages dir) using symbolic links on Windows?
I tried to create a symbolic link in the Python site-packages directory using the mklink /D
syntax (on a Win开发者_StackOverflow社区dows 7 machine). Unfortunately the module is not found when using import clause. When I copy the module physicaly to site-package directory, it works OK. Am I doing something wrong or is this just not possible on Windows?
I am using Python 2.6.
I just did it on Windows 7 using Python 2.7, and it works. Here are the steps I followed.
- open a windows command prompt with necessary privileges
cd to the site-packages directory
cd c:\Python27\Lib\site-packages
create the link
mklink /D modulename c:\path\to\module\real\location\modulename
精彩评论