开发者

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.

  1. open a windows command prompt with necessary privileges
  2. cd to the site-packages directory

    cd c:\Python27\Lib\site-packages

  3. create the link

    mklink /D modulename c:\path\to\module\real\location\modulename

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜